package fr.gla.hibtracker.historique.bm;

import java.io.Serializable;


/**
 * Identifiant composite de {@link ConfigModification}.
 *
 */
@SuppressWarnings("serial")
public class ConfigModificationID implements Serializable {
    private String className;

    private String el;

    public ConfigModificationID() {
        super();
    }

    public ConfigModificationID(String className, String el) {
        super();
        this.className = className;
        this.el = el;
    }

    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    public String getEl() {
        return el;
    }

    public void setEl(String el) {
        this.el = el;
    }

    @Override
    public boolean equals(Object obj) {
        ConfigModificationID id = (ConfigModificationID) obj;
        if (el == null || className == null || obj == null || id.getClassName() == null || id.getEl() == null) {
            return false;
        } else {
            return el.equals(id.getEl()) && className.equals(id.getClassName());
        }
    }

    @Override
    public int hashCode() {
        int hascode = 0;
        if (el != null) {
            hascode += el.hashCode();
        }
        if (className != null) {
            hascode += className.hashCode();
        }
        return hascode;
    }

    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder();
        if (className != null) {
            builder.append("clazz = ").append(className);
        }
        if (el != null) {
            builder.append(" el = ").append(el);
        }
        return builder.toString();
    }
}
